[id].vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- Banner1 -->
  5. <HomeBanner1></HomeBanner1>
  6. <!-- 面包屑导航 -->
  7. <div class="breadcrumb">
  8. <div class="inner">
  9. <span class="location">当前位置:</span>
  10. <el-breadcrumb :separator-icon="ArrowRight">
  11. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  12. <el-breadcrumb-item :to="{ path: `/primaryNavigation/${listid}` }" v-show="name">{{name}}</el-breadcrumb-item>
  13. <el-breadcrumb-item>{{ routeNewsTtitle }}</el-breadcrumb-item>
  14. </el-breadcrumb>
  15. </div>
  16. </div>
  17. <!-- 资讯列表 -->
  18. <div class="newsDetail">
  19. <div class="inner">
  20. <div class="innerLeft">
  21. <div class="LeftTop">
  22. <h1>{{ newsDetail.title }}</h1>
  23. <p>
  24. 来源: <span>{{ newsDetail.author }}</span>
  25. <span>{{ newsDetail.updated_at }}</span>
  26. 浏览量: <span>{{ newsDetail.hits }}</span>
  27. </p>
  28. <img :src="newsDetail.imgurl" alt="">
  29. </div>
  30. <div class="leftBottom" v-html="newsDetail.content">
  31. </div>
  32. </div>
  33. <div class="innerRight">
  34. <!-- 热点资讯1 -->
  35. <DetailHotNews></DetailHotNews>
  36. <!-- 热点资讯2 -->
  37. <DetailHotNews2></DetailHotNews2>
  38. </div>
  39. </div>
  40. </div>
  41. <!-- 页面底部 -->
  42. <HomeFoot></HomeFoot>
  43. </template>
  44. <script setup>
  45. import { onMounted } from 'vue'
  46. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  47. import { ArrowRight } from '@element-plus/icons-vue'
  48. const nuxtApp = useNuxtApp();
  49. const axios = nuxtApp.$axios;
  50. //获得跳转过来的id
  51. const route = useRoute();
  52. const articleId = route.params.id; //获得该页面的id
  53. const listid = route.query.listId; //获得该页面的id
  54. const name = route.query.listName; //获得该页面的id
  55. const newsDetail = ref({})
  56. console.log(articleId)
  57. const routeNewsTtitle = ref("");
  58. //获取详情
  59. const getNewsInfo = async () => {
  60. const response = await axios.get(`/web/selectWebsiteArticleInfo?articleid=${articleId}`);
  61. newsDetail.value = response.data;
  62. console.log(newsDetail.value.title)
  63. if(newsDetail.value.title.length > 30){
  64. routeNewsTtitle.value = newsDetail.value.title.substr(0,30) + "...";
  65. }
  66. }
  67. onMounted(()=>{
  68. getNewsInfo()
  69. })
  70. </script>
  71. <style lang="less" scoped>
  72. //导航条
  73. .breadcrumb {
  74. width: 100%;
  75. height: 22px;
  76. margin-bottom: 30px;
  77. font-family: Microsoft YaHei, Microsoft YaHei;
  78. font-weight: 400;
  79. font-size: 20px;
  80. color: #666666;
  81. line-height: 23px;
  82. text-align: left;
  83. font-style: normal;
  84. text-transform: none;
  85. .el-breadcrumb::v-deep{
  86. display: inline-block;
  87. vertical-align: -4px;
  88. }
  89. /deep/.el-breadcrumb__inner a,
  90. /deep/.el-breadcrumb__inner.is-link {
  91. color: #666666;
  92. font-weight: 400;
  93. text-decoration: none;
  94. transition: var(--el-transition-color);
  95. }
  96. span {
  97. font-family: Microsoft YaHei, Microsoft YaHei;
  98. font-weight: 400;
  99. font-size: 20px;
  100. color: #666666;
  101. line-height: 23px;
  102. text-align: left;
  103. font-style: normal;
  104. text-transform: none;
  105. }
  106. span:hover {
  107. color: #666666;
  108. }
  109. .location {
  110. margin-right: 20px;
  111. width: 100px;
  112. height: 22px;
  113. font-family: Microsoft YaHei, Microsoft YaHei;
  114. font-weight: 400;
  115. font-size: 20px;
  116. color: #666666;
  117. line-height: 23px;
  118. text-align: left;
  119. font-style: normal;
  120. text-transform: none;
  121. }
  122. }
  123. // 资讯列表
  124. .newsDetail {
  125. width: 100%;
  126. //height: 1400px;
  127. margin-bottom: 70px;
  128. .inner {
  129. width: 1200px;
  130. //height: 1400px;
  131. overflow: hidden;
  132. font-size: 16px;
  133. .innerLeft {
  134. // height: 1400px;
  135. border-top: 1px solid #139602;
  136. .LeftTop {
  137. height: 522px;
  138. margin-top: 50px;
  139. >h1 {
  140. line-height: 40px;
  141. margin-bottom: 30px;
  142. font-family: Microsoft YaHei, Microsoft YaHei;
  143. font-weight: bold;
  144. font-size: 30px;
  145. color: #333333;
  146. }
  147. >p {
  148. height: 18px;
  149. line-height: 18px;
  150. font-family: Microsoft YaHei, Microsoft YaHei;
  151. font-weight: 400;
  152. font-size: 14px;
  153. color: #999999;
  154. span {
  155. margin-right: 40px;
  156. }
  157. }
  158. >img {
  159. width: 680px;
  160. height: 382px;
  161. padding: 50px 0px 60px 55px;
  162. }
  163. }
  164. .leftBottom {
  165. width: 790px;
  166. height: 754px;
  167. margin-top: 76px;
  168. >h3,>p{
  169. text-indent: 2em;
  170. width: 790px;
  171. font-family: Microsoft YaHei, Microsoft YaHei;
  172. font-size: 20px;
  173. color: #333333;
  174. line-height: 23px;
  175. padding-bottom: 30px;
  176. }
  177. >h3 {
  178. font-weight: 600px;
  179. }
  180. >p {
  181. font-weight: 400;
  182. }
  183. }
  184. }
  185. .innerRight {
  186. width: 381px;
  187. height: 605px;
  188. background-color: #fbfbfb;
  189. border-top: 1px solid #139602;
  190. }
  191. }
  192. }
  193. </style>